<?php
include('connection.php');
include('thuvien.php');
class NhaSX
{
var $MaNSX;
var $TenNSX;
var $MoTa;
public function InfoNhaSX($MaNSX,$TenNSX,$MoTa)
{
$this->MaNSX=$MaNSX;
$this->TenNSX=$TenNSX;
$this->MoTa=$MoTa;
}
public function GetAll_NhaSX()
{
$sql="Select * From NhaSX";
$kq=@mysql_query($sql) or die (@mysql_error());
return $kq;
}
public function Add_NhaSX($TenNSX,$MoTa)
{
$sql="Insert Into NhaSX (`TenNSX`,`MoTa`)Values('$TenNSX','$MoTa')";
$kq=@mysql_query($sql) or die (@mysql_error());
}
public function Delete_NhaSX($id)
{
$sql="delete From NhaSX Where MaNSX=$id";
$kq=@mysql_query($sql) or die (@mysql_error());
return $kq;
}
public function Update_NhaSX($MaNSX,$TenNSX,$MoTa)
{
$sql="UPDATE `nhasx` SET  `TenNSX` =  '$TenNSX',`MoTa` =  '$MoTa' WHERE `MaNSX` =$MaNSX";
$kq=@mysql_query($sql) or die (@mysql_error());
return $kq;
}
public function ById($id)
{
$sql="Select * From NhaSX where MaNSX=$id";
$kq=@mysql_query($sql) or die (@mysql_error());
return $kq;
}
var $pindex;
var $totalp;

public function get_by_page($psize, $pindex, $where = '', $orderby = '')
{
	$this->pindex = $pindex;
	return get_page($psize, $pindex, $this->totalp, 'NhaSX', $where = "",$orderby = "");
}
public function print_page()
{
	return print_page($this->totalp, $this->pindex);
}
}
?>